package com.lq.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.lq.pojo.Shopping;
import com.lq.pojo.User;
import com.lq.service.ShoppingService;
import com.lq.service.UserService;

@Component
public class TestSchedule {
	@Autowired
	private ShoppingService shoppingService;
	
	@Scheduled(cron = "0 0 12 * * ?")
	public void printDate() {
		//更改了一下时间和注释了时间
		Date date=new Date();
		SimpleDateFormat sFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		//System.out.println("时间为:"+sFormat.format(date));
		
		List<Shopping> selByShoppingAll = shoppingService.selByShoppingAll();
		Iterator<Shopping> iterator = selByShoppingAll.iterator();
		while (iterator.hasNext()) {
			System.out.println(iterator.next());
		}
	}
}
